<?php

namespace App\Models;

use App\ModelFilters\KnowledgePostFilter;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;

class KnowledgePost extends BaseModel
{
    protected $table = 'tiku_knowledge_post';
    public const CREATED_AT = 'createdAt';
    public const UPDATED_AT = 'updatedAt';

    protected $guarded = [];

    public function modelFilter(): ?string
    {
        return $this->provideFilter(KnowledgePostFilter::class);
    }

    public function collect(): BelongsToMany
    {
        return $this->belongsToMany(KnowledgePost::class, 'tiku_user_knowledge_post', 'postId', 'id');
    }
}
